<!DOCTYPE html [ <!ENTITY nbsp "&#160;"> ]>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui" template="/template/template.xhtml">
	
	<title>RefAxion | Gestion de Talleres Mecanicos</title>

			<link type="image/x-icon" href="img/favicon.ico" rel="shortcut icon" />
			<link rel="shortcut icon" href="img/favicon.ico" />
			<f:metadata>
				<f:event type="preRenderView" listener="#{formVehiculoBean.iniciar}" />
			</f:metadata> 

	<ui:define name="body">   
		<h1>Formulario de Ingreso de Vehiculo al Sistema</h1>

		<h:form id="formRegistroVehiculo" enctype="multipart/form-data">
		
			<p:panel id="idPanelInfoCliente" header="Ingresar Rut de Dueño de Vehiculo">
					<table>
						<tr>
							<td><h:outputLabel value="Rut (Ej.11222333-4) : " /></td>
							<td><p:inputText id="rut" value="#{formVehiculoBean.clienteSeleccionadoVehiculo.rut}" disabled="true" />
							
							<p:commandButton 
								id="idBuscarClienteButton" 
								process="@this" update=":mensajesGlobales, :idBuscarClienteDialog" 
								actionListener="#{formVehiculoBean.listarClientes}"
								value="Buscar Cliente"
								oncomplete="buscarClienteDialog.show()" />
							</td>

						</tr>
						<tr>
							<td><h:outputLabel value="Nombre : " /></td>
							<td><p:inputText id="nombre" 
							value="#{formVehiculoBean.clienteSeleccionadoVehiculo.apellidoPaterno} #{formVehiculoBean.clienteSeleccionadoVehiculo.apellidoMaterno} #{formVehiculoBean.clienteSeleccionadoVehiculo.nombre}"
							style="width: 300px;white-space: normal"
							disabled="true" /></td>

						</tr>
						
					</table>	
			</p:panel>
			<p:panel id="idPanelInfoVehiculo" header="Ingresar Informacion del Vehiculo">
			
					<table >
						<tr>
							<td><h:outputLabel value="Fecha Ingreso : " /></td>
							<td><p:calendar id="fechaIngreso"
								value="#{formVehiculoBean.vehiculoNuevo.fechaIngresoTrans}"
								disabled="#{formVehiculoBean.desabilitado}"
								locale="es" pattern="dd-MM-yyyy"
								readonlyInput="true" navigator="true">
								<!-- <f:validator validatorId="dateRangeValidator" /> -->
								<f:attribute name="fechaIngreso"
									value="#{formVehiculoBean.vehiculoNuevo.fechaIngresoTrans}" />
							</p:calendar> </td>
							
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td><h:outputLabel value="Gata : " /></td>
							<td>&nbsp;</td><td>&nbsp;</td>
						    <td>
						    	<p:selectOneRadio id="gata" value="#{formVehiculoBean.vehiculoNuevo.gata}" disabled="#{formVehiculoBean.desabilitado}">  
						            <f:selectItem itemLabel="    Si   " itemValue="1" /> 
						            <f:selectItem itemLabel="    No   " itemValue="2" />  
						        </p:selectOneRadio> 
							</td>

						</tr>
						<tr>
							<td><h:outputLabel value="Matricula (Ej.XXFF11) : " /></td>
							<td><p:inputText id="matricula" value="#{formVehiculoBean.vehiculoNuevo.matricula}" required="true" disabled="#{formVehiculoBean.desabilitado}" /></td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td><h:outputLabel value="Radio : " /></td>
							<td>&nbsp;</td><td>&nbsp;</td>
						    <td>
						    	<p:selectOneRadio id="radio" value="#{formVehiculoBean.vehiculoNuevo.radio}" disabled="#{formVehiculoBean.desabilitado}">  
						            <f:selectItem itemLabel="    Si   " itemValue="1" /> 
						            <f:selectItem itemLabel="    No   " itemValue="2" />  
						        </p:selectOneRadio> 
							</td>

						</tr>
						<tr>
							<td><h:outputLabel value="Marca : " /></td>
							<td><p:selectOneMenu id="marca"
									value="#{formVehiculoBean.vehiculoNuevo.idMarca}" disabled="#{formVehiculoBean.desabilitado}">	
									<f:selectItem itemLabel="Seleccione" />
									<f:selectItems value="#{formVehiculoBean.listadoDeMarcas}"/>	
									<p:ajax event="change" update="modelo"  process="marca"
									    listener="#{formVehiculoBean.listaModelos}" />
								</p:selectOneMenu>
							</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td><h:outputLabel value="Rueda de Repuesto : " /></td>
							<td>&nbsp;</td><td>&nbsp;</td>
						    <td>
						    	<p:selectOneRadio id="ruedaRepuesto" value="#{formVehiculoBean.vehiculoNuevo.ruedaRepuesto}" disabled="#{formVehiculoBean.desabilitado}">  
						            <f:selectItem itemLabel="    Si   " itemValue="1" /> 
						            <f:selectItem itemLabel="    No   " itemValue="2" />  
						        </p:selectOneRadio> 
							</td>
				
						</tr>
						<tr>
							<td><h:outputLabel value="Modelo : " /></td>	
							<td><p:selectOneMenu id="modelo"
									value="#{formVehiculoBean.vehiculoNuevo.idModelo}" disabled="#{formVehiculoBean.desabilitado}">
									<f:selectItem itemLabel="Seleccione" />
									<f:selectItems value="#{formVehiculoBean.listadoDeModelos}"/>
									</p:selectOneMenu>
							</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td><h:outputLabel value="Extintor : " /></td>
							<td>&nbsp;</td><td>&nbsp;</td>
						    <td>
						    	<p:selectOneRadio id="extintor" value="#{formVehiculoBean.vehiculoNuevo.extintor}"
						    	disabled="#{formVehiculoBean.desabilitado}">  
						            <f:selectItem itemLabel="    Si   " itemValue="1" /> 
						            <f:selectItem itemLabel="    No   " itemValue="2" />  
						        </p:selectOneRadio> 
							</td>
						</tr>					
						<tr>
								<td><h:outputLabel value="Color : " /></td>
							    <td><p:selectOneMenu id="color"
									value="#{formVehiculoBean.vehiculoNuevo.color}" disabled="#{formVehiculoBean.desabilitado}">									
									<f:selectItem itemLabel="Seleccione" itemValue="" />  
            						<f:selectItem itemLabel="Blanco" itemValue="1" />  
						            <f:selectItem itemLabel="Negro" itemValue="2" />  
						            <f:selectItem itemLabel="Rojo" itemValue="3" />
						            <f:selectItem itemLabel="Azul" itemValue="4" />  
						            <f:selectItem itemLabel="Gris" itemValue="5" />  
						            <f:selectItem itemLabel="Verde" itemValue="6" />
						            <f:selectItem itemLabel="Plateado" itemValue="7" />    
									</p:selectOneMenu>
								</td>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
								<td><h:outputLabel value="Botiquin : " /></td>
								<td>&nbsp;</td><td>&nbsp;</td>
							    <td>
							    	<p:selectOneRadio id="botiquin" value="#{formVehiculoBean.vehiculoNuevo.botiquin}"
							    	disabled="#{formVehiculoBean.desabilitado}">  
							            <f:selectItem itemLabel="    Si   " itemValue="1" /> 
							            <f:selectItem itemLabel="    No   " itemValue="2" />  
							        </p:selectOneRadio> 
								</td>
			
						</tr>						
						<tr>
								<td><h:outputLabel value="Año Modelo : " /></td>
							    <td><p:selectOneMenu id="anno"
									value="#{formVehiculoBean.vehiculoNuevo.anno}" disabled="#{formVehiculoBean.desabilitado}">									
									<f:selectItem itemLabel="Seleccione" />
									<f:selectItems value="#{formVehiculoBean.listaAnnos}" />   
									</p:selectOneMenu>
								</td>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
								<td><h:outputLabel value="Triangulos : " /></td>
								<td>&nbsp;</td><td>&nbsp;</td>
							    <td>
							    	<p:selectOneRadio id="triangulos" value="#{formVehiculoBean.vehiculoNuevo.triangulos}"
							    	disabled="#{formVehiculoBean.desabilitado}">  
							            <f:selectItem itemLabel="    Si   " itemValue="1" /> 
							            <f:selectItem itemLabel="    No   " itemValue="2" />  
							        </p:selectOneRadio> 
								</td>
			
						</tr>
						<tr>
								<td><h:outputLabel value="Tipo de Transmision : " /></td>
							    <td><p:selectOneMenu id="tipoTransmision"
									value="#{formVehiculoBean.vehiculoNuevo.tipoTransmision}"
									disabled="#{formVehiculoBean.desabilitado}">									
									<f:selectItem itemLabel="Seleccione" itemValue="" />  
            						<f:selectItem itemLabel="Electrica" itemValue="1" />  
						            <f:selectItem itemLabel="Mecanica" itemValue="2" />     
									</p:selectOneMenu>
								</td>
			
						</tr>
						<tr>
							<td>&nbsp;</td>
							<td><font face="arial" size="1" color="#858585">Incluya el VIN (NIV, Serial de chasis, Serial de carrocería),</font></td>
						</tr>
						<tr>
							<td>&nbsp;</td>
							<td><font face="arial" size="1" color="#858585">código alfanumérico de 17 caracteres, que identifica al auto.</font></td>
						</tr>
						<tr>
							<td><h:outputLabel value="VIN : " /></td>
							<td><p:inputText id="vim" value="#{formVehiculoBean.vehiculoNuevo.vin}" required="true" disabled="#{formVehiculoBean.desabilitado}" /></td>							
						</tr>						
						<tr>
							<td><h:outputLabel value="Kilometraje : " /></td>
							<td><p:inputText id="kilometraje" value="#{formVehiculoBean.vehiculoNuevo.kilometraje}" required="true" disabled="#{formVehiculoBean.desabilitado}" /></td>
						</tr>
						<tr>
							<td><h:outputLabel value="Cant. Combustible : " /></td>
							<td><p:inputText id="combustible" value="#{formVehiculoBean.vehiculoNuevo.combustible}" required="true" disabled="#{formVehiculoBean.desabilitado}" /></td>
						</tr>
						<tr>
							<td><h:outputLabel value="Observacion : " /></td>
							<td><p:inputTextarea cols="50" id="observacion" 
							value="#{formVehiculoBean.vehiculoNuevo.observacion}"
							required="true" disabled="#{formVehiculoBean.desabilitado}"
							style="width: 300px;white-space: normal" /></td>
						</tr>			
					</table>								
					</p:panel>	
					<!-- <p:blockUI block="idPanelInfoVehiculo" blocked="true"/> -->  

					<p:commandButton value="Registrar Vehiculo" action="#{formVehiculoBean.registrarVehiculoNuevo}" styleClass="btnEnviar"
								process="@form" update="@form"/>
		</h:form>
		<!-- PopUps Include -->
		<ui:include src="/mantenedor/vehiculo/popup/busquedaCliente.xhtml" />
		
	</ui:define>
</ui:composition>		